import React, { Component } from 'react';
import RowTableHeadView from "./rowTableHeadView";
import {Input} from "antd";

export default class FormulaInputCompoent extends Component {

    constructor(props) {
        super(props);
        this.state = {
            value:this.props.formulaText
        };
    };

    /**
     * When a Cell value changes, re-determine the display value
     * by calling the formula calculation
     */
    onChange = (e) => {
        this.setState({ value: e.target.value })
    }


    componentWillReceiveProps(nextProps){
        this.setState({
            value:nextProps.formulaText
        });
    }


    render() {
        return (
            <Input placeholder="总账公式..." value={this.state.value} onChange={this.onChange} />
        )
    }
}
